add 'correct' option to duplicate filter
authorparkrrrr <parkrrrr@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Thu, 18 Mar 2004 16:26:25 +0000 (16:26 +0000)
committerparkrrrr <parkrrrr@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Thu, 18 Mar 2004 16:26:25 +0000 (16:26 +0000)
gpsbabel/README
gpsbabel/duplicate.c

index d5444e9aae23dd232c23003c2484cb626845b64f..c9c48e0a44b150313aa5c25ee8aac845af1b6d00 100644 (file)
@@ -571,7 +571,13 @@ DATA FILTERS
         with the "all" option.  This option can be useful as an "ignore
         list" in some circumstances.
 
-    DISTANCE ALONG A ROUTE (ARC)
+       Finally, the duplicate filter takes a "correct" option.  If you
+       specify that option, the latitude and longitude frmo later duplicates
+       will replace the latitude and longitude in earlier waypoints.  You
+       can use this to apply a list of "waypoint corrections" to a larger
+       file, while keeping all of the other details from the larger file.
+
+    DISTANCE FROM A ROUTE (ARC)
     ARC
 
         The arc filter is designed to include points based on their
index e9213ad5d8245eb9d693bbf6b8bc85e50814bf03..6ff4ceb0e317ebba7e4886164f2e393cc6e41db6 100644 (file)
@@ -26,6 +26,7 @@ extern queue waypt_head;
 static char *snopt = NULL;
 static char *lcopt = NULL;
 static char *purge_duplicates = NULL;
+static char *correct_coords = NULL;
 
 static
 arglist_t dup_args[] = {
@@ -35,6 +36,8 @@ arglist_t dup_args[] = {
                ARGTYPE_BOOL},
        {"all", &purge_duplicates, "Suppress all instances of duplicates",
                ARGTYPE_BOOL},
+       {"correct", &correct_coords, "Use coords from duplicate points", 
+               ARGTYPE_BOOL},
        {0, 0, 0, 0}
 };
 
@@ -271,6 +274,10 @@ duplicate_process(void)
                        if ( delwpt ) {
                                waypt_free(delwpt);
                        }
+                       if ( correct_coords && oldnode && oldnode->wpt ) {
+                               oldnode->wpt->latitude = waypointp->latitude;
+                               oldnode->wpt->longitude = waypointp->longitude;
+                       }
                        delwpt = waypointp;
                        waypt_del(waypointp); /* collision */
                        xfree(newnode);